<!DOCTYPE html>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<style>
#t {
  width: 50px;
  height: 50px;
  transition: transform 250ms linear;
  background-color: green;
}
</style>
<div id=t></div>
<script>
var test = async_test("Hit testing should not interrupt transition scheduling");
var counter = 0;
requestAnimationFrame(function() {
  t.style.transform = 'translate(500px)';
  // We can't use requestAnimationFrame to schedule here as that would
  // force timing updates to occur and avoid the crbug.com/501297 issue.
  setTimeout(function() {
    t.style.transitionDuration = '10000000s';
    t.style.transform = 'translate(1000px)';
    // The original transition should be long finished, the new one should
    // start from a translate-x greater than 500.
    requestAnimationFrame(function() {
      var tx = +/([\d.]+), [\d.]+\)/.exec(getComputedStyle(t).transform)[1];
      test.step(function() {
        assert_true(tx >= 500);
      });
      test.done();
    });
  }, 500);
});

setInterval(function() {
  document.elementFromPoint(50, 50);
}, 1);
</script>
